import { customApi, downloadApi } from './handleApi';

/** 算法标识管理 */
export const getAlgorithms = customApi<SearchCriteria>('/algorithm/list');
export const delete_algorithm_name_api = (algorithm_name: string) =>
  customApi(`/algorithm/delete/${algorithm_name}`, 'delete');
export const createAlgorithm = customApi('/algorithm/create');
export const updateAlgorithm = customApi('/algorithm/update', 'put');

/** 数据集管理 */
export const getDatasets = customApi<SearchCriteria>('/dataset/list');
export const downladDataset = downloadApi('/dataset/download', 'GET');
export const updatedataset = customApi('/dataset/update', 'PUT');

export const createdataset = customApi('/dataset/create');
export const algorithmtree = customApi('/algorithm/tree', 'GET');
export const datasettree = customApi('/dataset/tree', 'get');
export const datasetAddFiles = customApi('/dataset/files/add');
export const addFilesByTime = customApi('/dataset/files/add_files_by_time');
export const uploadDataset = (dataset_id: string) =>
  customApi('/dataset/upload?dataset_id=' + dataset_id);
export const addDatasetTag = customApi('/dataset/tag/create');
export const putDatasetTag = customApi('/dataset/tag/update', 'PUT');
export const delDatasetTag = (tag_id: string) =>
  customApi('/dataset/tag/delete?tag_id=' + tag_id, 'DELETE');

/** 数据集删除 */
export const delete_dataset_id_api = (id: string) =>
  customApi(`/dataset/delete?id=${id}`, 'delete');

/** 数据集总图片 */
export const getpictures = customApi<SearchCriteria>('/file/list');

export const delete_picture_id_api = (id: string) =>
  customApi(`/file/delete/${id}`, 'delete');

/** 数据集图片 */
export const getDatasetPicture = customApi<SearchCriteria>(
  '/dataset/files/list',
);
export const delete_dataset_picture_api = (dataset_id: string, id: string) =>
  customApi(
    `/dataset/files/delete?dataset_id=${dataset_id}&id=${id}`,
    'delete',
  );

/** 数据分析 - 结构化数据模块 */
// 绘制数据图
export const getAnalysis_graph = customApi<{
  start_time: string;
  end_time: string;
  ai_type: string;
}>('/analysis/analysis/analysis_graph');
// 获取设备和摄像头树
export const getSnCamTree = customApi('/analysis/sn_cam/tree', 'get');
